local gongzhu = fk.CreateSkill {
  name = "lingling__gongzhu",
  tags = { Skill.Compulsory }
}

Fk:loadTranslationTable {
  ["lingling__gongzhu"] = "功逐",
  [":lingling__gongzhu"] = "锁定技，当你受到伤害后，若为本回合首次受到伤害，你回复1点体力，否则失去1点体力。",
}

gongzhu:addEffect(fk.Damaged, {
  mute = true,
  on_use = function(self, event, target, player, data)
    local room = player.room
    --player:drawCards(1, gongzhu.name)
    if player.dead then return end
    local damage_event = room.logic:getActualDamageEvents(1, function(e) return e.data.to == player end)[1]
    if damage_event and damage_event.data == data then
      room:notifySkillInvoked(player, gongzhu.name, "defensive")
      if player:isWounded() then
        room:recover {
          who = player,
          num = 1,
          skillName = gongzhu.name,
        }
      end
    else
      room:notifySkillInvoked(player, gongzhu.name, "negative")
      room:loseHp(player, 1, gongzhu.name)
    end
  end,
})

return gongzhu
